<template>
  <div class="about">
    <div class="container">
      <h1 class="section-title">{{ $t('about.title') }}</h1>
      
      <div class="about-content">
        <div class="about-text card">
          <p>{{ $t('about.description') }}</p>
        </div>
        
        <div class="skills-section">
          <h2>{{ $t('about.skills') }}</h2>
          <div class="skills-grid">
            <div v-for="skill in skills" 
                 :key="skill.name"
                 class="skill-card card"
            >
              <i :class="skill.icon"></i>
              <h3>{{ skill.name }}</h3>
              <div class="skill-progress">
                <div class="progress-bar" :style="{ width: skill.level + '%' }"></div>
              </div>
              <span class="skill-level">{{ skill.level }}%</span>
            </div>
          </div>
        </div>
        
        <div class="experience-section">
          <h2>{{ $t('about.experience') }}</h2>
          <div class="timeline">
            <div v-for="exp in experience" 
                 :key="exp.id"
                 class="timeline-item card"
            >
              <div class="timeline-content">
                <h3>{{ exp.title }}</h3>
                <p class="company">{{ exp.company }}</p>
                <p class="period">{{ exp.period }}</p>
                <p class="description">{{ exp.description }}</p>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <BackToTop />
  </div>
</template>

<script>
import BackToTop from '@/components/BackToTop.vue'

export default {
  name: 'About',
  
  components: {
    BackToTop
  },
  
  data() {
    return {
      skills: [
        {
          name: 'Vue.js',
          icon: 'fab fa-vuejs',
          level: 90
        },
        {
          name: 'JavaScript',
          icon: 'fab fa-js',
          level: 85
        },
        {
          name: 'HTML5',
          icon: 'fab fa-html5',
          level: 95
        },
        {
          name: 'CSS3',
          icon: 'fab fa-css3-alt',
          level: 88
        },
        {
          name: 'Node.js',
          icon: 'fab fa-node-js',
          level: 75
        },
        {
          name: 'Git',
          icon: 'fab fa-git-alt',
          level: 82
        }
      ],
      experience: [
        {
          id: 1,
          title: '高级前端开发工程师',
          company: 'XX科技有限公司',
          period: '2020 - 至今',
          description: '负责公司核心产品的前端开发工作，包括架构设计、性能优化等。'
        },
        {
          id: 2,
          title: '前端开发工程师',
          company: 'XX网络科技公司',
          period: '2018 - 2020',
          description: '参与多个项目的开发，负责页面开发和组件库维护。'
        }
      ]
    }
  }
}
</script>

<style lang="scss" scoped>
.about {
  padding: 2rem 0 4rem;
}

.section-title {
  text-align: center;
  margin-bottom: 3rem;
  color: var(--accent-color);
}

.about-content {
  max-width: 800px;
  margin: 0 auto;
}

.about-text {
  margin-bottom: 4rem;
  padding: 2rem;
  line-height: 1.8;
}

.skills-section,
.experience-section {
  margin-bottom: 4rem;
  
  h2 {
    text-align: center;
    margin-bottom: 2rem;
  }
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.skill-card {
  text-align: center;
  padding: 2rem;
  
  i {
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
  }
  
  h3 {
    margin-bottom: 1rem;
  }
}

.skill-progress {
  height: 6px;
  background-color: var(--bg-secondary);
  border-radius: 3px;
  margin: 1rem 0;
  overflow: hidden;
  
  .progress-bar {
    height: 100%;
    background-color: var(--accent-color);
    border-radius: 3px;
    transition: width 1s ease-in-out;
  }
}

.timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  
  &::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background-color: var(--accent-color);
  }
}

.timeline-item {
  margin-bottom: 2rem;
  position: relative;
  width: calc(50% - 2rem);
  
  &:nth-child(odd) {
    margin-left: auto;
  }
  
  &::before {
    content: '';
    position: absolute;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--accent-color);
  }
  
  &:nth-child(odd)::before {
    left: -2.5rem;
  }
  
  &:nth-child(even)::before {
    right: -2.5rem;
  }
}

.timeline-content {
  padding: 1.5rem;
  
  h3 {
    color: var(--accent-color);
    margin-bottom: 0.5rem;
  }
  
  .company {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
  }
  
  .period {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }
}

@media (max-width: 768px) {
  .timeline {
    &::before {
      left: 0;
    }
  }
  
  .timeline-item {
    width: calc(100% - 2rem);
    margin-left: 2rem !important;
    
    &::before {
      left: -2rem !important;
    }
  }
}
</style> 